<!-- 顶部下拉导航 -->
<xmp type="template" name="top_drop_down_navigation">
    <dropdownnav>
        <div bind-class="{{class}}">
            <Wrap>
                {{#each screenings}}
                <screening>
                    <p>{{screeningtitle}}</p>
                    <hr size="1" />{{#each categorys}}
                    <p>
                        <input type="checkbox" name="{{name}}" value={ "{{value}}}" />
                        <label>{{title}}</label>
                    </p>
                    {{/each}}
                </screening>
                {{/each}}
            </Wrap>
            <Wrap>
                {{#each buttons}}
                <button bind-class="{{class}}" name="{{name}}">{{button}}</button>
                {{/each}}
                </Warp>
        </div>
    </dropdownnav>
</xmp>
<script type="text/vm" name="top_drop_down_navigation">
function(vm) {
    var cabtn = vm.queryElement({
        name: "cancel"
    })[0];
    console.log(cabtn);
    require(["jQuery"], function($) {
        var cbtn = $(cabtn);
        cbtn.click(function() {
            a = $("dropdownnav")[0];
            $(a).animate({
                top: -265
            }, 800);
        });
    });
}
</script>


<!-- 顶部导航栏 -->
<xmp type="template" name="topnav">
    <topNav>
        <topNavInfo>
            <userBlock>
                <p><a>{{user}}</p>
                </user>
                <p><a>{{register}}</a>
                </p>
            </userBlock>
            <cartBlock>
                {{#each i}}
                <p>
                    <i bind-class="{{class}}" bind-title="{{title}}"></i>
                    <a bind-href="{{href}}">{{a_title}}</a>
                </p>
                {{/each}}

            </cartBlock>
        </topNavInfo>
    </topNav>
</xmp>
<script type="text/vm" name="topnav">
function(vm) {
    var getI = vm.queryElement({
        tagName: "I"
    })[2];
    console.log(getI);
    require(["jQuery"], function($) {
        var obj = $(getI);
        obj.click(function() {
            a = $("dropdownnav")[0];
            // alert(a.length);
            $(a).animate({
                top: 0
            }, 800);
        });
    });
}
</script>

<!-- 商品简述图片轮播 -->
<xmp type="template" name="commodity">
    <commodity>
        <commodityImg>
            <eachChild>
                {{#each imgs}}
                <img bind-src="{{src}}" />{{/each}}
            </eachChild>
        </commodityImg>
        <commoditySketch>
            <detail>
                <price>{{price}}</price>
                <outline>{{outline}}</outline>
            </detail>
            <store>{{store}}</store>
        </commoditySketch>
    </commodity>
</xmp>
<script type="text/vm" name="commodity">
function(vm) {
    var eachChildNode = vm.queryElement({
        tagName: "EACHCHILD"
    })[0];
    console.log(eachChildNode)
    require(["jQuery"], function($) {
        var imgs = $(eachChildNode);
        var img = imgs.find("img");
        var i = 1;
        timer = setInterval(function() {
            imgs.animate({
                bottom: 200 * (i % img.length)
            }, 800);
            i += 1;
        }, 2000);
    });
}
</script>



<!-- 这里开始是实际要用的 -->

<!-- 图片轮播  大 -->
<xmp type="template" name="pic_wall">
    <div class="carosule">
        <div class="pic-show">
            <div class="face"></div>
            {{#each pic}}
                <div class="pic">
                    <!-- <a bind-href="{{href}}"> -->
                    <img bind-src="{{src}}" bind-title="{{title}}"/>
                    <!-- </a> -->
                </div>
            {{/each}}
        </div>
    </div>
</xmp>
<script type="text/vm" name="pic_wall">
function (vm) {
    require(["jQuery"], function($) {
      var index=0;
      var $_picn=$(".pic").length;
      setInterval(function(){
        show(index);
        index++;
        if(index==$_picn){index=0;}
      },5000);
      function show(index){
        $(".pic").eq(index).fadeIn(800).siblings(".pic").fadeOut(800);
      }
    });
}
</script>



<!-- 首页推荐商品 -->
<xmp type="template" name="main-goods">
    <div class="commodity">
        <div class="commodityImg">
            <div class="eachChild">
                <a bind-href="{{href}}">
                    <img bind-src="{{src}}" bind-style="width:{{width}};height:{{height}};left:{{left}};top:{{top}}" bind-title="{{title}}" />
                    <div class="main-goods-dec">
                        <p>
                            {{text}}
                        </p>
                    </div>
                </a>
            </div>
        </div>
    </div>
</xmp>
<script type="text/vm" name="main-goods">
function(vm) {
    var eachChild=vm.queryElement({
        className:"eachChild"
    })[0];
    var img=vm.queryElement({
        tagName:"IMG"
    })[0]
    // console.log($(eachChild));
    require(["jQuery"], function($) {
        var index=0;
        var height=$(img).css("height").split("p")[0];
        timer = setInterval(function() {
            $(eachChild).animate({
                bottom: height*(index%2)
            }, 800);
            index+=1;
        }, getRadom());
    });

    function getRadom(){
        var a=0;
        while(a<4000){
            var a=Math.random()*10000
        }
        console.log(a);
        return a;
    }
}
</script>

<!-- 这个输入框，默认值用来提示，点击自动清空 -->
<xmp  type="template" name="auto-clear-input">
    <input bind-maxlength="{{maxlength}}" bind-type="{{type}}" bind-name="{{name}}" bind-id="{{id}}" bind-placeholder="{{placeholder}}" />
</xmp>
<script type="text/vm" name="auto-clear-input">
function(vm){  
    var input=vm.queryElement({
        tagName:"INPUT"
    })[0];
    require(["jQuery"], function($) {
        // var value=$(input).val();
        // $(input).focus(function(){
        //     if ($(input).val()==value) {
        //         $(input).val("");
        //         ;
        //     };
        // });
        //  $(input).blur(function(){
        //     if ($(input).val()=='') {
        //         $(input).val(value);
        //         ;
        //     };
        // });
    
        // $(input).keyup(function(){
        //     $(this).val($(this).val().replace(/[^\w\.\-\_\@/]/ig,''));}).bind("paste",function(){  //CTR+V事件处理 
        //         $(this).val($(this).val().replace(/[^\w\.\-\_\@/]/ig,''));  
        //     }).css("ime-mode", "disabled");  //CSS设置输入法不可用
    });
}
</script>

<!-- 显示最新5条评论消息 -->
<xmp type="template" name="recommend-goods">
    <div>
        <a bind-href="{{href}}"><img bind-src="{{src}}"></a>
        <p>
            <i>{{user}}:</i>
            {{text}}
        </p>
    </div>
</xmp>

<xmp type="template" name="goods">
    <div class="goods" bind-name="{{name}}" bind-style="background-color:{{bgcolor}}">
        <a bind-href="{{base_url}}/goods-details.html?id={{_id}}" target="_blank"><img bind-src="{{preview_img_url}}?imageView/1/w/165/h/165"></a>
        <!-- <a bind-href="{{href}}"><img bind-src="{{src}}"></a> -->
        <div class="details">
            <span class="goods_name"><a bind-href="{{href}}">{{goods_name}}</a></span><br />
            <span class="price">{{price}}</span><br />
            <span class="describe">{{describe}}</span>
        </div>
    </div>
</xmp>
<script type="text/vm" name="goods">
    function(vm){
        var goods_box=vm.queryElement({
            className:"goods"
        })[0];
        var fg=vm.queryElement({
            tagName:"IMG"
        })[0];
        var bg=vm.queryElement({
            className:"details"
        })[0];
        require(["jQuery"], function($) {
            var name=$(goods_box).attr("name");
            // console.log(name);
            if (name%4==0) {
                $(fg).mouseover(function(){
                    $(goods_box).css("zIndex","2");           
                    $(bg).stop().animate({
                        right:165,opacity:100
                    },300); 
                });
                $(fg).mouseout(function(){
                    $(bg).stop().animate({
                        right:0,opacity:0
                    },300);
                    $(goods_box).css("zIndex","1");
                });
            }else{                
                $(fg).mouseover(function(){
                    $(goods_box).css("zIndex","2");           
                    $(bg).stop().animate({
                        left:165,opacity:100
                    },300); 
                });
                $(fg).mouseout(function(){
                    $(bg).stop().animate({
                        left:0,opacity:0
                    },300);
                    $(goods_box).css("zIndex","1");
                });   
            }
        });
    }
</script>



<!-- 购物车 -->
<xmp type="template" name="carts">
    <div class="cart">
        <div class="cart-item goods-img">
            <img bind-src="{{src}}">
        </div>

        <div class="cart-item detail">
            <a bind-href="{{href}}">{{detail}}</a>
        </div>

        <div class="cart-item choice">
            <div class="choice1"><b>颜色:{{choice1}}</b></div>
            <div class="choice2"><b>尺码:{{choice2}}</b></div>
            <div class="count">
                <a class="cut">-</a>
                <input maxlength="3" type="text" name="count" class="amount" bind-value="{{value}}" />
                <a class="plus">+</a>
            </div>
        </div>

        <div class="cart-item price">
            <b>￥<span class="price_num">{{price}}</span></b>
        </div>

        <div class="cart-item method">
            <div class="collection"><a>收藏</a></div>
            <div class="remove"><a>移除</a></div>
        </div>
    </div>
</xmp>
<script type="text/vm" name="carts">
    function(vm){
        var carts=vm.queryElement({
            className:"cart"
        })[0];
        var _cut_btn=vm.queryElement({
            className:"cut"
        })[0];
        var _add_btn=vm.queryElement({
            className:"plus"
        })[0];
        var input=vm.queryElement({
            tagName:"INPUT"
        })[0];
        var _remove_btn=vm.queryElement({
            className:"remove"
        })[0];
        require(["jQuery"], function($) {

            //增减
            $(_cut_btn).mousedown(function(){
                if($(input).val()>1){
                    $(input).val(parseInt($(input).val())-1);
                }
            });
            $(_add_btn).mousedown(function(){
                if($(input).val()<999){
                    $(input).val(parseInt($(input).val())+1);
                }
            });


            $(_remove_btn).click(function(){
                $(carts).remove();
            });

            $(input).change(function(){
                if ($(input).val()=="") {
                    $(input).val(1);
                };
            })
            $(input).keyup(function(){  //只能输入数字s
                $(this).val($(this).val().replace(/\D/g,''));}).bind("paste",function(){  //CTR+V事件处理 
                    $(this).val($(this).val().replace(/\D/g,''));  
                }).css("ime-mode", "disabled");  //CSS设置输入法不可用

        })
    }
</script>

<xmp type="template" name="goods-main-img.bak">
    <div id="goods-main-img">
        <!-- <commodityImg>
            <eachChild>
                {{#each imgs}}
                <img bind-src="{{src}}" />{{/each}}
            </eachChild>
        </commodityImg> -->
        <div id="imgWall">
            <div id="imgBox">
                {{#each bigImg}}
                <img class="big-img" bind-src="{{src}}" />
                {{/each}}
            </div>
        </div>

        <div id="small-img-box">
            {{#each smallImg}}
            <img class="small-img" name="small-img" bind-id="{{data}}" bind-src="{{src}}" onClick="change_img(this)" />
            {{/each}}
        </div>
    </div>
</xmp>
<xmp type="template" name="goods-main-img">
    <div id="goods-main-img">

{{#if detail_img_urls.length}}
        <div id="imgWall">
            <div id="imgBox" class="role-img-box">
                {{#each detail_img_urls}}
                <img class="big-img" bind-src="{{$This}}" />
                {{/each}}
            </div>
        </div>
        <div id="small-img-box">
            {{#each detail_img_urls}}
            <img _index="{{$Index}}" class="small-img" name="small-img" bind-src="{{$This}}" onClick="change_img(this)" />
            {{/each}}
        </div>
{{#else}}
        <div id="imgWall">
            <div id="imgBox">
                <img class="big-img" bind-src="{{preview_img_url}}" />
            </div>
        </div>
{{/if}}
    </div>

</xmp>
<script type="text/vm" name="goods-main-img">
    function(vm){
        var imgWall;
        var imgBox;
        var smallImgs;
        vm.oninsert = function () {
            var ti = setInterval(function () {
                imgBox = $("#imgBox.role-img-box");
                if (imgBox.length) {
                    smallImgs=$(".small-img");
                    imgWall = $("#imgWall");
                    clearInterval(ti);
                    if(imgBox.height()>$(window).height()){
                        console.log(imgBox.find(".big-img").height());
                        imgWall.css({
                            height:(imgBox.find(".big-img").height()||imgBox.width())+"px",
                        });
                    }
                    _auto_animate();
                }
            });
        }
        var ii=0;
        var ti;
        function _auto_animate(argument) {
            clearTimeout(ti);
            ti = setTimeout(function () {
                // console.log("???xx",ii);
                ii+=1;
                ii = ii % smallImgs.length;
                var _item = smallImgs[ii];
                if (_item) {
                    change_img(_item);
                }
            },5000);
        }
        function change_img(obj){
            
            var i = ~~obj.getAttribute("_index");
            var $obj = $(obj);
            var button_length = 0;
            var bigImg;
            imgBox.find(".big-img").each(function (_i,img) {
                // console.log(_i,i);
                if (i>_i) {
                    button_length+=$(img).height();
                }else{
                    bigImg = img;
                    return false
                }
            });
            console.log($(bigImg).height());
            imgBox.stop().animate({
                "bottom":button_length+"px",
                'border':'1px solid red'
            },800);
            imgWall.css({
                "height":$(bigImg).height()+"px"
            });
            ii=i;
            smallImgs.css({
                // 'border':'0',
                opacity:0.5
            });
            $obj.css({
                opacity:1
            });
            _auto_animate();
        }
        window.change_img = change_img;
    }
</script>


<xmp type="template" name="m-goods-main-img">
    <div id="goods-main-img">

{{#if detail_img_urls.length}}
        <div id="imgWall">
            <div id="imgBox" class="role-img-box">
                {{#each detail_img_urls}}
                <img class="big-img" bind-src="{{$This}}" />
                {{/each}}
            </div>
        </div>
        <div id="small-img-box">
            {{#each detail_img_urls}}
            <img _index="{{$Index}}" class="small-img" name="small-img" bind-src="{{$This}}" onClick="change_img(this)" />
            {{/each}}
        </div>
{{#else}}
        <div id="imgWall">
            <div id="imgBox">
                <img class="big-img" bind-src="{{preview_img_url}}" />
            </div>
        </div>
{{/if}}
    </div>

</xmp>
<script type="text/vm" name="m-goods-main-img">
    function(vm){
        var imgWall;
        var imgBox;
        var smallImgs;
        vm.oninsert = function () {
            var ti = setInterval(function () {
                imgBox = $("#imgBox.role-img-box");
                if (imgBox.length) {
                    smallImgs=$(".small-img");
                    imgWall = $("#imgWall");
                    clearInterval(ti);
                    if(imgBox.width()>$(window).width()){
                        // console.log(imgBox.find(".big-img").height());
                        imgWall.css({
                            height:(imgBox.find(".big-img").height()||imgBox.width())+"px",
                        });
                    }
                    _auto_animate();
                }
            });
        }
        var ii=0;
        var ti;
        function _auto_animate(argument) {
            clearTimeout(ti);
            ti = setTimeout(function () {
                // console.log("???xx",ii);
                ii+=1;
                ii = ii % smallImgs.length;
                var _item = smallImgs[ii];
                if (_item) {
                    change_img(_item);
                }
            },5000);
        }
        function change_img(obj){
            
            var i = ~~obj.getAttribute("_index");
            var $obj = $(obj);
            var button_length = 0;
            var bigImg;
            imgBox.find(".big-img").each(function (_i,img) {
                // console.log(_i,i);
                if (i>_i) {
                    button_length+=$(img).height();
                }else{
                    bigImg = img;
                    return false
                }
            });
            // console.log($(bigImg).height());
            imgBox.stop().animate({
                "right":button_length+"px",
                'border':'1px solid red'
            },800);
            imgWall.css({
                "height":$(bigImg).width()+"px"
            });
            ii=i;
            smallImgs.css({
                // 'border':'0',
                opacity:0.5
            });
            $obj.css({
                opacity:1
            });
            _auto_animate();
        }
        window.change_img = change_img;
    }
</script>


<xmp type="template" name="goods-count">
    <div class="count">
        <input class="button" type="button" value="-" name="cut" />
        <input class="text" type="text" value="1" name="num" />
        <input class="button" type="button" value="+" name="add" />
    </div>
</xmp>
<script type="text/vm" name="goods-count">
function(vm){
    var _cut_btn=vm.queryElement({
        name:"cut"
    })[0];
    var _num=vm.queryElement({
        name:"num"
    })[0];
    var _add_btn=vm.queryElement({
        name:"add"
    })[0];
    // console.log(_cut_btn+"wow");
    require(["jQuery"], function($) {
        $(_cut_btn).click(function(){
            if($(_num).val()>1){
                $(_num).val(parseInt($(_num).val())-1);
            }
        });

        $(_add_btn).click(function(){
            $(_num).val(parseInt($(_num).val())+1);
        });
    })
}
</script>

<xmp type="template" name="qrcode">
    <div name="codebox"></div>
    <input type="hidden" bind-value="{{value}}" />
</xmp>
<script type="text/vm" name="qrcode">
function(vm){
    var code_box=vm.queryElement({
        tagName:"DIV"
    })[0];
    var code_text=vm.queryElement({
        tagName:"INPUT"
    })[0];
    require(["jQuery","jQuery.qrcode"], function($) {
            $(code_box).qrcode({
                render:window.dispatchEvent?"canvas":"table",
                width: 100, 
                height:100,
                text: $(code_text).val() //任意内容,Unicode编码,不支持中文
            });
        
    });
}
</script>


<!-- 订单 -->
<xmp type="template" name="orders">
    <div class="order-box">
        <div class="goods-img">
            <img bind-src="{{src}}">
        </div>

        <div class="goods-info">
            <div class="goods-info-item first">订单号：{{orderId}}</div>
            <div class="goods-info-item second">{{goodsname}}</div>
            <div class="goods-info-item third">{{store}}</div>
            <div class="last goods-info-item">{{date}}</div>
        </div>

        <div class="price">
            <div class="price-item first">{{price}}</div>
            <div class="price-item">{{type}}</div>
        </div>

        <div class="method">
            <div bind-name="{{name}}" class="method-item first">{{title}}</div>
            {{#each methodItem}}
            <div bind-name="{{name}}" class="method-item">{{title}}</div>
            {{/each}}
        </div>
    </div>
</xmp>

<!-- 收藏 -->
<xmp type="template" name="collection">
    <div class="collection">
        <div class="img">
            <img bind-src="{{src}}" />
        </div>
        <div class="details">
            <div class="price">{{price}}</div>
            <div class="name">{{name}}</div>
            <div class="store">{{store}}</div>
        </div>
    </div>
</xmp>
<xmp type="template" name="user_ach_controller">
        <div class="method">
    <!-- 在线付款 -->
        <!-- 未付款 -->
            {{#if info.state==$Top.config.achs_status.weifukuan}}
            <div>你还未付款
                <button event-click="{{'$Top.$Event.pays.alipay_build'}}" class="method-item">去付款</button>
                {{HTML $Top.$Cache.alipay_submit_pay_ach}}
            </div>
            {{/if}}
        <!-- 已付款 -->
            {{#if info.state==$Top.config.achs_status.yifukuan}}
            <div>付款完成，等待货物发出
                <button class="method-item">去催货</button>
            </div>
            {{/if}}
        <!-- 运货中 -->
            {{#if info.state==$Top.config.achs_status.yunhuozhong}}
            <div>货物已经发出
                <!-- <button class="method-item">查看货物位置</button> -->
    <ul>
        {{#each info.transportation_point}}
       <li>{{address}}（{{#Time create_time}}）</li>
        {{/each}}
    <!--     <li>
            <input type="text" bind-input="{{'$Private.new_ach_point.address'}}">
            <button event-click="{{'$Top.$Event.admin.ach.add_ach_point'}}">添加</button>
        </li> -->
    </ul>
            </div>
            {{/if}}
        <!-- 确认收货 -->
            {{#if info.state==$Top.config.achs_status.qurenshouhuo}}
            <div>货物已经收到了吧~
                <button class="method-item">去评价商品</button>
            </div>
            {{/if}}
        <!-- 已评价，over -->
            {{#if info.state==$Top.config.achs_status.yijingpingjia}}
            <div>
                <button class="method-item">查看我的评价</button>
            </div>
            {{/if}}
    <!-- 货到付款 -->
        <!-- 未发货 -->
            {{#if info.state==$Top.config.achs_status.weifahuo}}
            <div>货物未送出
                <button class="method-item">去催货</button>
            </div>
            {{/if}}
        <!-- 运货中 -->
            {{#if info.state==$Top.config.achs_status.yifahuo}}
            <div>货物已经发出
                <!-- <button class="method-item">查看货物位置</button> -->
    <ul>
        {{#each info.transportation_point}}
       <li>{{address}}（{{#Time create_time}}）</li>
        {{/each}}
    </ul>
            </div>
            {{/if}}
        <!-- 确认收获并付款 -->
            {{#if info.state==$Top.config.achs_status.querenshouhuobingfukuan}}
            <div>等待商家确认收款
            </div>
            {{/if}}
        <!-- 未评价2 -->
            {{#if info.state==$Top.config.achs_status.weipingjia2}}
            <div>点击对应的商品链接去评价<br>或查看评价
            </div>
            {{/if}}
        <!-- 已经评价 -->
            {{#if info.state==$Top.config.achs_status.yijingpingjia2}}
            <div>
                <button class="method-item">查看我的评价</button>
            </div>
            {{/if}}
        </div>
</xmp>

<xmp type="template" name="bus_ach_controller">
    <div class="method">
<!-- 在线付款 -->
    <!-- 未付款 -->
        {{#if info.state==$Top.config.achs_status.weifukuan}}
        <div>用户还未付款，等待付款
        </div>
        {{/if}}
    <!-- 已付款 -->
        {{#if info.state==$Top.config.achs_status.yifukuan}}
        <div>用户付款完成，等待货物发出
            <div class="method-item">去发货</div>
        </div>
        {{/if}}
    <!-- 运货中 -->
        {{#if info.state==$Top.config.achs_status.yunhuozhong}}
        <div>货物运输中
            <div class="method-item">修改货物位置信息</div>
        </div>
        {{/if}}
    <!-- 确认收货 -->
        {{#if info.state==$Top.config.achs_status.qurenshouhuo}}
        <div>货物已送达
            <div class="method-item">完成结算</div>
        </div>
        {{/if}}
    <!-- 未评价 -->
        {{#if info.state==$Top.config.achs_status.weipingjia}}
        <div>用户未评价商品
            <div class="method-item">请求评价</div>
        </div>
        {{/if}}
    <!-- 已评价，over -->
        {{#if info.state==$Top.config.achs_status.yijingpingjia}}
        <div>
            <div class="method-item">查看评价</div>
        </div>
        {{/if}}

<!-- 货到付款 -->
    <!-- 未发货 -->
        {{#if info.state==$Top.config.achs_status.weifahuo}}
        <div>用户货到付款，等待货物发出
            <button event-click="{{'$Top.$Event.admin.ach.weifahuo_to_yifahuo'}}" class="method-item">去发货</button>
        </div>
        {{/if}}
    <!-- 运货中 -->
        {{#if info.state==$Top.config.achs_status.yifahuo}}
        <div>货物运输中<br>
            <!-- <button event-click="{{'$Top.$Event.admin.ach.update_transportation_point'}}" class="method-item">修改货物位置信息</button> -->
    <!-- {{#if $Private.show_update_ach_points}} -->
    <!-- <ul>
        {{#each info.transportation_point}}
       <li>{{address}}（{{#Time create_time}}）</li>
        {{/each}}
        <li>
            <input type="text" bind-input="{{'$Private.new_ach_point.address'}}">
            <button event-click="{{'$Top.$Event.admin.ach.add_ach_point'}}">添加</button>
        </li>
    </ul> -->
    <!-- {{/if}} -->
    {{#if info.express_id}}
        {{#if !_update_express_id}}
            物流号：{{info.express_id}}
            <button event-click="{{'$Top.$Event.ach.to_update_express'}}">修改物流号</button>
        {{#else}}
            物流号：<input type="text" value="{{info.express_id}}" bind-input="{{'$Top.$Cache.ach.info.express_id'}}" value="{{info.express_id}}">
            <button event-click-end-editor="{{'$Top.$Event.ach.end_update_exporess'}}" event-click="{{'$Top.$Event.ach.update_express_id'}}">设置物流号</button>
        {{/if}}
    {{#else}}
        物流号：<input type="text" bind-input="{{'$Top.$Cache.ach.info.express_id'}}" value="{{info.express_id}}">
        <button event-click="{{'$Top.$Event.ach.update_express_id'}}">设置物流号</button>
    {{/if}}
    <button event-click="{{'$Top.$Event.admin.ach.yifahuo_to_querenshouhuobingfukuan'}}" class="method-item">确认货物送达</button>
        </div>
        {{/if}}
       
    <!-- 确认收获并付款 -->
        {{#if info.state==$Top.config.achs_status.querenshouhuobingfukuan}}
        <div>货物已送达
            <button event-click="{{'$Top.$Event.admin.ach.querenshouhuobingfukuan_to_weipingjia2'}}" class="method-item">确认收款</button>
        </div>
        {{/if}}
    <!-- 未评价2 -->
        {{#if info.state==$Top.config.achs_status.weipingjia2}}
        <div>交易完成
            <!-- <button event-click="{{'$Top.$Event.admin.ach.qingqiupingjia'}}" class="method-item">请求评价</button> -->
        </div>
        {{/if}}
    <!-- 已经评价 -->
        {{#if info.state==$Top.config.achs_status.yijingpingjia2}}
        <div>
            <button class="method-item">查看评价</button>
        </div>
        {{/if}}
    </div>
</xmp>
<script type="text/vm" name="bus_ach_controller">
    function (tvm) {
require(["common","jQuery","coAjax","queryString"],function(jSouper,$,coAjax,QueryString){


        // App.set("$Event.admin.ach.update_transportation_point",function (e,vm) {
        //     console.log(vm.get(),vm.get("$Private"));
        //     vm.set("$Private.show_update_ach_points",true);
        // });

        App.set("$Event.admin.ach.add_ach_point",function (e,vm) {
            var address = vm.get("$Private.new_ach_point.address");
            if (!$.trim(address)) {
                alert("地址不可为空");
                return;
            }
            var new_ach_point = {
                address:address,
                create_time:+new Date
            };
            var ach_points = vm.get("info.transportation_point");
            ach_points.push(new_ach_point);
            coAjax.put(appConfig.bus.ach_points+vm.get("_id"),{
                ach_points:ach_points
            },function (result) {
                console.log(result.result);
                vm.set("info.transportation_point",result.result);
            });
        });

        App.set("$Event.admin.ach.weifahuo_to_yifahuo",function (e, vm) {
            coAjax.put(appConfig.bus.achs_weifahuo_to_yifahuo+vm.get("_id"),function (result) {
                console.log(result.result);
                vm.set("info.state",result.result);
                // alert("状态值修改成功！！");
            });
        });
        App.set("$Event.admin.ach.yifahuo_to_querenshouhuobingfukuan",function (e, vm) {
            coAjax.put(appConfig.bus.achs_yifahuo_to_querenshouhuobingfukuan+vm.get("_id"),function (result) {
                console.log(result.result);
                vm.set("info.state",result.result);
                // alert("状态值修改成功！！");
            });
        });
        App.set("$Event.admin.ach.querenshouhuobingfukuan_to_weipingjia2",function (e, vm) {
            coAjax.put(appConfig.bus.achs_querenshouhuobingfukuan_to_weipingjia2+vm.get("_id"),function (result) {
                console.log(result.result);
                vm.set("info.state",result.result);
                // alert("状态值修改成功！！");
            });
        });


})





    }
</script>